package com.quanyan.orderpay.service;

import com.quanyan.api.APIRequest;
import com.quanyan.api.APIResponse;
import com.quanyan.api.enums.ApiResponseEnum;
import com.quanyan.assets.response.RespBankInfo;
import com.quanyan.common.enums.BaseEnum;
import com.quanyan.orderpay.request.*;
import com.quanyan.orderpay.response.*;
import com.quanyan.pay.enums.RefundStatusEnum;

import java.util.List;

/**
 * @author songzj
 * @date 16/6/3-17:36
 */
public interface OrderPayService {

    String GROUP_ORDER_STATUS_NOTIFY = "GOSN_ORDER"; //订单状态Group.
    String INSTANCE_ORDER_STATUS_NOTIFY = "IOSN_ORDER"; //订单状态实例.
    String TOPIC_ORDER_STATUS_NOTIFY = "TOSN_ORDER"; //订单状态topic.
    String TOPIC_ORDER_REFUND_SUBMIT_NOTIFY = "TOPIC_REFUND_SUBMIT"; //退款申请状态topic.
    String TOPIC_ORDER_REFUND_STATUS_NOTIFY = "TORSN_REFUND"; //退款状态topic.
    String TOPIC_ORDER_CLOSE_STATUS_NOTIFY = "TORSN_CLOSE"; //关闭状态topic.
    String TOPIC_ORDER_CALLBACK_NOTIFY = "TOPIC_CALLBACK";                //订单回调topic
    String TOPIC_WITHDRAW_CALLBACK_NOTIFY = "TOPIC_WITHDRAW_NOTIFY";     //提现回调topic

    /**
     * 提交订单信息
     * 如果outTradeNo和orderNo存在. 则以最新数据为准生成订单信息.
     * 返回已签名的第三方支付对象, 可直接调起支付.
     *
     * @param orderSaveApiRequest
     * @return
     */
    APIResponse<RespPreOrder> submitOrder(APIRequest<ReqOrderSave> orderSaveApiRequest);


    /**
     * 取消未支付订单
     *
     * @param orderCancelAPIRequest
     * @return
     */
    APIResponse<BaseEnum> orderCancel(APIRequest<ReqOrderCancel> orderCancelAPIRequest);


    /**
     * 用户提交退款申请, 支持部分退款.
     *
     * @param orderRefundAPIRequest
     * @return
     */
    APIResponse<RefundStatusEnum> refundApply(APIRequest<ReqOrderRefund> orderRefundAPIRequest);

    /**
     * 用户提交退款申请, 支持部分退款.
     *
     * @param orderRefundAPIRequest
     * @return
     */
    APIResponse<RespRefund> refund(APIRequest<ReqOrderRefund> orderRefundAPIRequest);


    /**
     * 管理员审核退款
     *
     * @param auditEntityAPIRequest
     * @return
     */
    APIResponse<ApiResponseEnum> auditRefundApply(APIRequest<ReqAuditEntity> auditEntityAPIRequest);


    /**
     * 批量退款
     *
     * @param batchOrderRefundAPIRequest
     * @return
     */
    APIResponse<RespBatchOrderRefund> batchRefundApply(APIRequest<ReqBatchOrderRefund> batchOrderRefundAPIRequest);


    /**
     * 查询已开启的支付方式
     *
     * @param reqPayInfo
     * @param
     * @return
     */
    APIResponse<List<RespPayInfo>> selectEnablePayInfos(ReqSysPayInfo reqPayInfo);


    /**
     * 申请开通支付方式
     *
     * @param reqPayInfo
     * @return
     */
    APIResponse<List<RespPayInfo>> applyEnablePayInfos(ReqSysPayInfo reqPayInfo);


    /**
     * 获取微信appId. securityKey
     *
     *
     * @param reqWeichatAccountAPIRequest
     * @return
     */
    APIResponse<RespWeichatAccount> getWeichatAccount(APIRequest<ReqWeichatAccount> reqWeichatAccountAPIRequest);



    /**
     * 申请提现
     */
    APIResponse applyWithdraw(ReqWithdrawApply reqWithdrawApply);

    /**
     * 用户提现，获取调用支付宝批量付款到支付宝账户有密接口的HTML表单
     */
    APIResponse batchTrans(ReqWithdrawFormData reqWithdrawTransfer);

    /**
     * 提现申请列表
     * @param reqWithdrawApplyList
     * @return
     */
    APIResponse queryApplyWidthdrawList(ReqWithdrawApplyList reqWithdrawApplyList);

    /**
     * 该接口提供各个业务系统支付订单的查询。
     */
    APIResponse<RespOrderInfo> orderQuery(APIRequest<ReqOrderInfo> reqOrderAPIRequest);

    /**
     * 该接口提供财务对账批量查询。
     */
    APIResponse<List<RespOrderInfo>> orderQueryBacth(List<String> orderList);

    /**
     * 用户提现，调用微信企业支付接口打款给用户
     */
    APIResponse transferFundByWechat(WithdrawPayInfo payInfo);

    /**
     * 用户提现，获取调用支付宝批量付款到支付宝账户有密接口的HTML表单
     */
    APIResponse getBatchTransferFundByAlipayHtmlForm(ReqWithdrawFormData reqWithdrawTransfer);

    APIResponse<List<RespBankInfo>> getBankList();

    /**
     * 银联pos支付异常处理
     * @param unionPayExcepVo
     * @return 1:处理成功，0：处理失败
     */
    int posUnionPayExcepton(ReqPosUnionPayExcepVo unionPayExcepVo);


}
